package com.assets;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.ViewGroup;

import com.assets.Check.newTanWanCheck.BaseActivity1;
import com.assets.databinding.ActivityShowBitmapBinding;
import com.bumptech.glide.Glide;

import java.io.File;

public class ShowBitmapActivity extends BaseActivity1 {
    private ActivityShowBitmapBinding mBinding;

    public static void show(Activity activity, String imageHttpUrl) {
        Intent intent = new Intent(activity, ShowBitmapActivity.class);
        intent.putExtra("imageHttpUrl", imageHttpUrl);
        activity.startActivity(intent);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding = ActivityShowBitmapBinding.inflate(getLayoutInflater());
        setContentView(mBinding.getRoot());
        getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        initView();
        getIntentData();
    }

    private void initView() {
        mBinding.tvTitle.titleText.setText("图片展示");
        mBinding.tvTitle.fh.setOnClickListener(v -> {
            finish();
        });
    }

    private void getIntentData() {
        Intent intent = getIntent();
        String imageHttpUrl = intent.getStringExtra("imageHttpUrl");
        if (!TextUtils.isEmpty(imageHttpUrl)){
            Glide.with(this).load(imageHttpUrl).into(mBinding.photoView);
        }
    }

}
